﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using Planer.Model;

namespace Planer.UI.Controls
{
    public partial class FinancicalGoalPresentButton : Button
    {
        financial_goal goal;

        public financial_goal Goal
        {
            get { return goal; }
            set { 
                goal = value;
                if (goal == null) return;

                StringBuilder sb = new StringBuilder();
                sb.Append(goal.name);                
                sb.Append(" - ");
                sb.Append(String.Format("{0:f} p.", goal.balance));
                sb.Append("  ");
                float percents = (float)(goal.balance / goal.necessary);
                sb.Append(String.Format("({0:f}%)", percents));
                this.Text = sb.ToString();
            }
        }

        public FinancicalGoalPresentButton()
        {
            InitializeComponent();
            this.AutoSize = true;
            this.Height = 50;
            this.BackColor = Color.FromArgb(150, 207, 233, 241);
        }

        public FinancicalGoalPresentButton(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
            
        }
    }
}
